package study;

import java.util.Random;

public class algorithm {
    public static void main(String[] args){
        culculate(5);
    }
    public static  void culculate(int i){
        int[] arr = new int[100];
        Random r = new Random();
        for(int j = 0;j < i;j++){
            arr[j] = r.nextInt(10);
        }
        for(int j = 0;j < i;j++){
            System.out.println(arr[j]);
        }
        int head = 0;
        int back = i;
        while(head < back){
            //System.out.print(arr[head]);
            arr[back] = arr[head + 1];
            head = head + 2;
            back++;
            if(head == back - 1){
                System.out.println(arr[head]);
            }
        }
    }
}
